home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / pmake / lst / RCS / lstIsAtEnd.c,v < prev    next >
Encoding:
Text File  |  1992-05-19  |  2.0 KB  |  81 lines

  1. head     1.6;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.6
  10. date     88.11.17.20.53.14;  author adam;  state Exp;
  11. branches ;
  12. next     ;
  13.  
  14.  
  15. desc
  16. @@
  17.  
  18.  
  19.  
  20. 1.6
  21. log
  22. @checked in with -k by kupfer at 92.05.18.17.32.41.
  23. @
  24. text
  25. @/*-
  26.  * LstIsAtEnd.c --
  27.  *    Tell if the current node is at the end of the list.
  28.  *    The sequential functions access the list in a slightly different way.
  29.  *    CurPtr points to their idea of the current node in the list and they
  30.  *    access the list based on it. Because the list is circular, Lst_Next
  31.  *    and Lst_Prev will go around the list forever. Lst_IsAtEnd must be
  32.  *    used to determine when to stop.
  33.  *
  34.  * Copyright (c) 1988 by University of California Regents
  35.  *
  36.  * Permission to use, copy, modify, and distribute this
  37.  * software and its documentation for any purpose and without
  38.  * fee is hereby granted, provided that the above copyright
  39.  * notice appears in all copies.  Neither the University of California nor
  40.  * Adam de Boor makes any representations about the suitability of this
  41.  * software for any purpose.  It is provided "as is" without
  42.  * express or implied warranty.
  43.  */
  44. #ifndef lint
  45. static char *rcsid =
  46. "$Id: lstIsAtEnd.c,v 1.6 88/11/17 20:53:14 adam Exp $ SPRITE (Berkeley)";
  47. #endif lint
  48.  
  49. #include    "lstInt.h"
  50.  
  51. /*-
  52.  *-----------------------------------------------------------------------
  53.  * Lst_IsAtEnd --
  54.  *    Return true if have reached the end of the given list.
  55.  *
  56.  * Results:
  57.  *    TRUE if at the end of the list (this includes the list not being
  58.  *    open or being invalid) or FALSE if not. We return TRUE if the list
  59.  *    is invalid or unopend so as to cause the caller to exit its loop
  60.  *    asap, the assumption being that the loop is of the form
  61.  *        while (!Lst_IsAtEnd (l)) {
  62.  *              ...
  63.  *        }
  64.  *
  65.  * Side Effects:
  66.  *    None.
  67.  *
  68.  *-----------------------------------------------------------------------
  69.  */
  70. Boolean
  71. Lst_IsAtEnd (l)
  72.     Lst        l;
  73. {
  74.     register List list = (List) l;
  75.  
  76.     return (!LstValid (l) || !list->isOpen ||
  77.         (list->atEnd == Head) || (list->atEnd == Tail));
  78. }
  79.  
  80. @
  81.